package com.example.teesystem.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.teesystem.entity.Assistant;
import com.example.teesystem.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @description 针对表【t_assistant】的数据库操作Mapper
 */
@Mapper
public interface AssistantMapper extends BaseMapper<Assistant> {
    @Select("select * from t_assistant where id = #{id} and is_delete = 0")
    User getAssistantUserById(Integer id);

    @Select("select permission from t_assistant where assistant_id = #{assistantId} and course_id = #{courseId} and is_delete = 0")
    Long getAssistantPermission(int assistantId,int courseId);

    @Select("select id from t_assistant where assistant_id = #{assistantId} and course_id = #{courseId} and is_delete = 0")
    int getAssistantId(int assistantId,int courseId);

    List<Assistant> selectAllByCourseId(@Param("courseId") Integer courseId);

    List<Integer> selectAssistantIdByCourseId(@Param("courseId") Integer courseId);

    @Select("select * from t_assistant where assistant_id = #{assistantId} and course_id = #{courseId} and is_delete = 0")
    Assistant getAssistant(int assistantId,int courseId);
}
